<template>
  <view class="stand">
    <view class="stand-title">{{ detail.title }}</view>
    <view class="flex-x-c b-w stand b-shadow">
      <view class="stand-left flex-y-c" @click="goPersonalDetail(1, detail.professionalUserId)">
        <u-avatar class="avator" size="50" :src="detail.professionalAvatar"></u-avatar>
        <view class="avator-name">{{ detail.professionalName }}</view>
      </view>
      <view class="flex-y-c">
        <image class="pair-stand" src="@/static/public/pair.png"></image>
        <view class="pair-status">建站成功</view>
      </view>
      <view class="stand-right flex-y-c" @click="goPersonalDetail(2, detail.enterpriseUserId)">
        <u-avatar class="avator" size="50" :src="detail.enterpriseAvatar"></u-avatar>
        <view class="avator-name">{{ detail.enterpriseName }}</view>
      </view>
    </view>
    <view class="foot-bar flex-x-c" v-if="identifying == 'admin'">
      <view class="flex-x-c">
        <u-button
          class="btn"
          type="error"
          @click="handleDelete"
          text="删除"
          customStyle="marginRight: 20rpx"
        ></u-button>
      </view>
    </view>
    <public-dialog ref="dialog"></public-dialog>
  </view>
</template>

<script>
export default {
  data() {
    return {
      id: '',
      detail: {},
    }
  },
  onLoad(param) {
    this.id = param.id
    this.getDetail(this.id)
  },
  methods: {
    getDetail(id) {
      // 获取公告列表
      this.$request('/talentMatch/talentMatchInfo', {
        id,
      }).then((res) => {
        this.detail = res.result
      })
    },
    handleDelete() {
      const id = this.id
      this.$refs.dialog.confirm({
        title: '确认删除？',
        confirmBtnFn: () => {
          this.$request('/talentMatch/removeTalentMatch', { id }).then((res) => {
            this.$utils.toast('删除成功!')
            setTimeout(() => {
              uni.navigateBack({})
            }, 1000)
          })
        },
      })
    },
    goPersonalDetail(type, id) {
      let url = ''
      if (type == 1) {
        url = `/pages/form/workerForm`
      } else {
        url = `/pages/form/company`
      }
      url += `?userId=${id}`
      this.$routeUtils.navigateTo({ url })
    },
  },
}
</script>

<style lang="scss" scoped>
.stand {
  padding: 30rpx;
  .stand-title {
    margin-bottom: 40rpx;
    margin-top: 20rpx;
    text-align: center;
  }
}
.stand-item {
  padding: 30rpx;
  border-radius: 10rpx;
}
.stand {
  justify-content: space-around;
  padding: 40rpx;
  border-radius: 20rpx;
}
.stand-left {
  flex: 1;
  margin-right: 20rpx;
}
.stand-right {
  flex: 1;
  margin-left: 20rpx;
}
.stand-icon {
  width: 40rpx;
  height: 40rpx;
  flex-shrink: 0;
  margin-right: 10rpx;
}
.pair-stand {
  width: 100rpx;
  height: 100rpx;
}
.avator-name {
  margin-top: 20rpx;
  text-align: center;
}
.pair-status {
  font-size: 23rpx;
  color: $uni-color-primary;
}
.foot-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9;
  background-color: #fff;
  padding-top: 10rpx;
  padding-bottom: calc(10rpx + env(safe-area-inset-bottom));
  justify-content: flex-end;
  .btn {
    display: inline-flex;
    margin-right: 20rpx;
  }
}
</style>
